﻿Imports System.ComponentModel.DataAnnotations


Namespace Users

    Public Class GroupVO
        Inherits BaseVO

        Private _groupId As Integer
        Private _code As String
        Private _name As String
        Private _companyId As Integer
        Private _system As Boolean

        Private _company As CompanyVO

        Sub New()
        End Sub

        Sub New(entity As Data.BaseModel.Group)
            If entity IsNot Nothing Then
                groupId = entity.GroupId
                name = entity.Name
                code = entity.Code
                System = entity.System

                companyId = entity.CompanyId

                If entity.Company IsNot Nothing Then
                    company = New CompanyVO(entity.Company)
                End If
            End If
        End Sub

        Public Property groupId As Integer
            Get
                Return _groupId
            End Get
            Set(value As Integer)
                _groupId = value
            End Set
        End Property

        <RequiredAtt("name")> _
        Public Property name As String
            Get
                Return _name
            End Get
            Set(value As String)
                _name = value
            End Set
        End Property

        <StringLengthAtt(50, "code", 3)> _
        Public Property code() As String
            Get
                Return _code
            End Get
            Set(ByVal value As String)
                _code = value
            End Set
        End Property

        Public Property companyId() As Integer
            Get
                Return _companyId
            End Get
            Set(ByVal value As Integer)
                _companyId = value
            End Set
        End Property

        Public Property system As Boolean
            Get
                Return _system
            End Get
            Set(ByVal value As Boolean)
                _system = value
            End Set
        End Property
        Public Property company() As CompanyVO
            Get
                Return _company
            End Get
            Set(ByVal value As CompanyVO)
                _company = value
            End Set
        End Property

    End Class

End Namespace